import { Storage } from '../tools/public'

function getRandom(a) {
  const b = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  for (let c = 10; c > 1; c--) {
    const d = Math.floor(10 * Math.random())
    const e = b[d]

    b[d] = b[c - 1]
    b[c - 1] = e
  }

  let d = 0
  for (let c = 0; c < 5; c++) {
    d = 10 * d + b[c]
  }
  return (a || '') + (d + '' + +new Date())
}

// eslint-disable-next-line import/no-mutable-exports
let uuid = Storage.getSync('logReportUUID')
if (!uuid) {
  uuid = getRandom('L')
  Storage.setSync('logReportUUID', uuid)
}
function logReport (data){
  console.log("日志上报",data);
}
export default logReport
export { uuid }